package com.hzlx.batch.service.impl;

import java.util.List;

import com.hzlx.MesBatchesMaterialDto;
import com.hzlx.mesMaterialBatches.domain.MesMaterialBatches;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hzlx.batch.mapper.BatchesMaterialMapper;
import com.hzlx.batch.domain.BatchesMaterial;
import com.hzlx.batch.service.IBatchesMaterialService;

/**
 * 物料批次及数量Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-07-07
 */
@Service
public class BatchesMaterialServiceImpl implements IBatchesMaterialService 
{
    @Autowired
    private BatchesMaterialMapper batchesMaterialMapper;

    /**
     * 查询物料批次及数量
     * 
     * @param batchId 物料批次及数量主键
     * @return 物料批次及数量
     */
    @Override
    public BatchesMaterial selectBatchesMaterialByBatchId(Long batchId)
    {
        return batchesMaterialMapper.selectBatchesMaterialByBatchId(batchId);
    }

    @Override
    public BatchesMaterial selectByLimitOne(Integer materialId) {
        return batchesMaterialMapper.selectByOne(materialId);
    }

    /**
     * 查询物料批次及数量列表
     * 
     * @param batchesMaterial 物料批次及数量
     * @return 物料批次及数量
     */
    @Override
    public List<BatchesMaterial> selectBatchesMaterialList(BatchesMaterial batchesMaterial)
    {
        return batchesMaterialMapper.selectBatchesMaterialList(batchesMaterial);
    }

    /**
     * 新增物料批次及数量
     * 
     * @param batchesMaterial 物料批次及数量
     * @return 结果
     */
    @Override
    public int insertBatchesMaterial(BatchesMaterial batchesMaterial)
    {
        return batchesMaterialMapper.insertBatchesMaterial(batchesMaterial);
    }

    /**
     * 修改物料批次及数量
     * 
     * @param batchesMaterial 物料批次及数量
     * @return 结果
     */
    @Override
    public int updateBatchesMaterial(BatchesMaterial batchesMaterial)
    {
        return batchesMaterialMapper.updateBatchesMaterial(batchesMaterial);
    }

    @Override
    public int updateBatchesMaterialDto(MesBatchesMaterialDto mesBatchesMaterialDto) {
        MesMaterialBatches mesMaterialBatches=new MesMaterialBatches();
        BeanUtils.copyProperties(mesBatchesMaterialDto, mesMaterialBatches);
        return batchesMaterialMapper.updateBatchesMaterialDtO(mesMaterialBatches);
    }

    /**
     * 批量删除物料批次及数量
     * 
     * @param batchIds 需要删除的物料批次及数量主键
     * @return 结果
     */
    @Override
    public int deleteBatchesMaterialByBatchIds(Long[] batchIds)
    {
        return batchesMaterialMapper.deleteBatchesMaterialByBatchIds(batchIds);
    }

    /**
     * 删除物料批次及数量信息
     * 
     * @param batchId 物料批次及数量主键
     * @return 结果
     */
    @Override
    public int deleteBatchesMaterialByBatchId(Long batchId)
    {
        return batchesMaterialMapper.deleteBatchesMaterialByBatchId(batchId);
    }
}
